<template>
  <div class="d-item-wrap">
    <div class="d-title">
      {{title}}
    </div>
    <div class="d-content">
      <!--type 1 :单行 2：多行-->
      <div class="item fold-hide"
           v-for="item in list"
           :class="{'inline-wrap':item.singleLine === 1}"
           v-if="item.type != 999">
        <div class="label">
          {{item.label}}
        </div>
        <div class="txt txt2" v-if="item.type === 1 && item.singleLine === 1">
          {{item.value}}
        </div>
        <div class="txt" v-if="item.type === 1 && item.singleLine != 1">
          <div class="txt-multiLine">
            {{item.value}}
          </div>
        </div>
        <div v-if="item.type === 2 && item.singleLine != 1" class="txt">
          <div class="txt-checked-item txt-checked-item-file zj-file"
               v-for="(file,index) in item.value"
               @click="fileClick(file)"
               :key="index">
            {{file.name}}
          </div>
        </div>
      </div>
    </div>
    <foldWrap :list="listKeys"></foldWrap>
  </div>
</template>

<script>
  /*
   @param singleLine
   * 0 多行行文本显示
   * 1 单行文本显示
   @param type
   * 1 文本显示
   * 2 附件显示
   * */

  import foldWrap from "./fold.vue"

  export default {
    props: {
      title: {
        default: ""
      },
      list: {
        type: Object,
        default: {}
      },
    },
    data(){
      return {
        fileList: [],
        listKeys: []
      }
    },
    created(){
      this.listKeys = Object.keys(this._props.list);
    },
    methods: {
      fileClick(file){
        _methods.fileDownLoad(file);
      }
    },
    components: {
      foldWrap
    }
  }

</script>

